Navigating – Jumping to a Defined Position

This example shows how to jump to a specific position on the terrain. This example uses the ICreator80 (CreatePosition) and INavigate80 (JumpTo) methods.

 

private void JumpTo()

        {

            try

            {

                var SGWorld = new SGWorld80();

                // x,y,height, height type, yaw, pitch, roll, distance

                var newYork = SGWorld.Creator.CreatePosition(-80, 40.717167, 1000, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -45, 0, 0);

                // x,y,height, height type, yaw, pitch, roll, distance

                var losAngeles = SGWorld.Creator.CreatePosition(-118.25, 34.05, 1000, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -45, 0, 0);

                if (_evenCall)

                {

                    MessageBox.Show("Click ok to jump to New York city");

                    SGWorld.Navigate.JumpTo(newYork);

                }

                else

                {

                    MessageBox.Show("Click ok to jump to Los Angeles");

                    SGWorld.Navigate.JumpTo(losAngeles);

                }

                _evenCall = !_evenCall;

            }

            catch (Exception ex)

            {

                MessageBox.Show("Unexpected error: " + ex.Message);

            }

        }